project_name=$(basename "$(pwd)")
version="v1"

echo "======================开始部署:${project_name}======================"

echo "==============AppendRequestIdProcessor ========[1/5]暂停/清除容器======================"
docker stop ${project_name} && docker rm ${project_name}

echo "======================[2/5]删除镜像======================"
docker rmi ${project_name}:${version}

echo "======================[3/5]打包镜像======================"
docker build -t ${project_name}:${version} .

echo "======================[4/5]run images======================"

docker run -itd --name ${project_name} -v ./runtime:/opt/www/runtime --restart=always -p 9501:9501 ${project_name}:${version}

echo "======================[5/5]部署完成======================"


